package com.example.replacebooks.mapper;

import com.example.replacebooks.entity.Address;
import com.example.replacebooks.entity.Params;
import com.example.replacebooks.entity.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

@Repository
public interface AddressMapper extends Mapper<Address> {
    List<Address> findBySearch(@Param("params") Params params);

    @Select("select * from address where userid = #{params.userid}")
    List<Address> findById(@Param("params") Params params);

    @Select("select * from address where addressid = #{addressid} limit 1")
    Address findByAddressid(@Param("addressid") Integer addressid);

    @Update("update address set userid = #{userid},consigname = #{consigname},consigphone = #{consigphone},address = #{address} where addressid = #{addressid}")
    void updateByaddressid(Address address);

}

